﻿{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<body>
<div class="sub-body">
<h3 class="title-1">{$lang.sourcing_task_manage}</h3>
<div class="tab-frame">
    <div class="tab-title-1"><span>{$lang.sourcing_task_list}</span></div>
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display" id="tab-color1">
      <tr>
        <td class="tab-align-l" colspan="13"><form method="get" action="{url app=sourcing_task}" id="search_form">{$lang.status}：
		<input type="hidden" name="app" value="sourcing_task" />
          <select name="status" onChange="$('#search_form').submit();">
		  <!--{foreach from=$lang.sourcing_status item=status key=k}-->
		  <!--{if $k != 0}-->
            <option value="{$k}" {if $k == $search_status}selected{/if}>{$status}</option>
		  <!--{/if}-->
		  <!--{/foreach}-->
          </select><input type="button" value="打印采购清单" class="btn-2" style="margin-left:2em;" onClick="get_ids();$('#print_form').submit();"></form></td>
      </tr>
      <tr>
	  	<th>选择</th>
        <th>{$lang.No}</th>
        <th>{$lang.list_sn}</th>
        <th>{$lang.arrival_date}</th>
        <th>{$lang.brand_name}</th>
        <th>{$lang.merchandiser}</th>
        <th>{$lang.sample_sn}</th>
		<th>图片</th>
        <th>{$lang.ref_sample_style}</th>
        <th>{$lang.sourcing_assistant}</th>
        <th>{$lang.sourcing_days}</th>
        <th>{$lang.status}</th>
        <th>{$lang.handle}</th>
      </tr>
	  <form method="get" action="{url app=sourcing_task&act=print_qd}" id="print_form" target="_blank">
	  <input type="hidden" name="app" value="sourcing_task">
	  <input type="hidden" name="act" value="print_qd">
	  <input type="hidden" name="ids" id="ids" value="">
	  <!--{foreach from=$sourcing_list item=sourcing name=s}-->
      <tr>
	  	<td><input type="checkbox" value="{$sourcing.list_id}" checked></td>
        <td>{$smarty.foreach.s.iteration}</td>
        <td>{$sourcing.list_sn|escape}</td>
        <td>{$sourcing.arrival_date|date:y-m-d}</td>
        <td>{$sourcing.brand_name|escape}</td>
        <td>{$sourcing.user_name|escape}</td>
        <td>{$sourcing.sample_sn|escape}</td>
		<td><!--{if $sourcing.front_pic}--><a href="{$sourcing.front_pic|escape}" target="_blank"><img src="{$sourcing.front_pic|escape}" width="50"></a><!--{/if}--></td>
        <td>{$lang.ref_sample_styles.$sourcing.ref_sample_style}</td>
        <td>{$sourcing.sourcing_assistant|escape}</td>
        <td>{$sourcing.sourcing_days|escape}天</td>
        <td>{$lang.statuies.$sourcing.status}</td>
        <td><input type="button" class="btn-s-5" value="详细信息" onClick="location.href='{if $user.role == 4}{url app=sourcing_task&act=edit&id=$sourcing.list_id}{else}{url app=sourcing_task&act=show&id=$sourcing.list_id}{/if}'" /></td>
      </tr>
	  <!--{/foreach}-->
	  </form>
	  <!--{if $sourcing_list}-->
	  <tr>
	  	<td colspan="13" class="tab-align-l"><label><input type="checkbox" id="check_all" onClick="check_all($(this))" checked="checked">全选</label>&nbsp;&nbsp;<a href="" onClick="check_others(); return false;">反选</a></td>
	  </tr>
	  <!--{/if}-->
         </table>

  </div>
<script type="text/javascript">
function check_all(obj) {
	if (obj.attr('checked')) {
		$('input[name="ids"]').each(function(){
			$(this).attr('checked', true);
		});
	} else {
		$('input[name="ids"]').each(function(){
			$(this).attr('checked', false);
		});
	}
}
function check_others() {
	$('#check_all').attr('checked', false);
	$('input[name="ids"]').each(function(){
		$(this).attr('checked', !$(this).attr('checked'));
	});
}
function get_ids()
{
	var obj_ids = document.getElementsByTagName('input');
	var ids = '';
	for (var i = 0; i < obj_ids.length; i++) {
		if (obj_ids[i].type == 'checkbox' && obj_ids[i].id != 'check_all' && obj_ids[i].checked) {
			ids += obj_ids[i].value + ',';
		}
	}
	ids = ids.substring(0, ids.length - 1);
	document.getElementById('ids').value = ids;
}
</script>
{include file=page.html}
</div>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</body>
</html>